package cn.yedong.system.domain;

import cn.yedong.basic.domain.BaseDomain;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 实体类：
 */
@Data
public class Menu extends BaseDomain{
    //菜单名称
    private String name;
    //组件名称
    private String component;
    //路由地址
    private String url;
    //图标
    private String icon;
    //排序
    private Integer index;
    //上级菜单
    private Long parentId;
    //菜单简介
    private String intro;
    //菜单状态
    private Boolean state;
    //新增属性：回显上级菜单
    private Menu parentMenu;

    //用于封装当前菜单的子菜单
    @JsonInclude(JsonInclude.Include.NON_EMPTY)//部门树最后一级没有数据就不显示
    private List<Menu> children = new ArrayList<>();



    @Override
    public String toString() {
        return "Menu{" +
        ", name=" + name +
        ", component=" + component +
        ", url=" + url +
        ", icon=" + icon +
        ", index=" + index +
        ", parentId=" + parentId +
        ", intro=" + intro +
        ", state=" + state +
        "}";
    }
}
